package chapter09plus

/**
 * 处理异常
 */
object Test01_Exception {
  def main(args: Array[String]): Unit = {

    try {
      val n = 10 / 1
    } catch {
      case e: ArithmeticException => {
        println("发生算术异常")
      }

      case e: Exception => {
        println("发生一般异常")
      }

    } finally {
      println("处理结束")
    }
  }


  try {
  val  a=   10 / 1
  } catch {
    case e: Exception => {
      println("普通异常")
    }
    case e: NullPointerException => {
      println("空指针异常")
    }
  } finally {
    println("处理异常结束")
  }

}
